package com.syf.core.utils.classscan;

import java.util.Arrays;
import java.util.List;

public class MixedClassFilter implements ClassFilter {

    private List<ClassFilter> classFiltersList;

    public MixedClassFilter(List<ClassFilter> classFiltersList) {
        this.classFiltersList = classFiltersList;
    }

    public MixedClassFilter(ClassFilter... classFilters) {
        classFiltersList = Arrays.asList(classFilters);
    }

    @Override
    public boolean isMatch(Class clazz) {
        for (ClassFilter classFilter : classFiltersList) {
            if (!classFilter.isMatch(clazz)) {
                return false;
            }
        }

        return true;
    }
}
